package com.yxinsur.imc.business.enums;

import com.yxinsur.imc.common.utils.StringUtils;
import lombok.Getter;

/**
 * 继续率类型
 */
@Getter
public enum PersistencyRateTypeEnum {

	/**
	 * R13
	 */
	R13("R13","2"),
	/**
	 * R13
	 */
	R25("R25","3"),
	/**
	 * R37
	 */
	R37("R37","4"),
	/**
	 * R49
	 */
	R49("R49","5");

	private String code;
	private String year;

	private PersistencyRateTypeEnum(String code,String year) {
		this.code = code;
		this.year = year;
	}

	public static String getYearByKeyName(String code){
		String keyValue = null;
		if(StringUtils.isNotBlank(code)){
			for (PersistencyRateTypeEnum c : PersistencyRateTypeEnum.values()) {
				if (c.getCode().equals(code)) {
					keyValue = c.year;
				}
			}
		}
		return keyValue;
	}
}
